
@include('public.page_styles')

<style>
  .time-picker{
    width: 23%;
    height: 34px;
    padding: 6px 12px;
    font-size: 14px;
    line-height: 1.42857143;
    color: #555;
    background-color: #fff;
    background-image: none;
    border: 1px solid #ccc;
  }

    .modal{
        background: #f9fafc;
    }
  .modal-footer {
      border-top-color: #9a9393;
      /*padding: 0px;*/
  }
</style>

</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
@include('public.top')
  <!-- Left side column. contains the logo and sidebar -->
@include('public.sidebar')
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <h1>
        {{ trans('message.equipment') }}
        <small>{{ trans('message.add') }}</small>
      </h1>
      <ol class="breadcrumb">
        <li><a ><i class="fa fa-dashboard"></i> {{ trans('message.home') }}</a></li>
        <li><a href="{{ url('equipment/list') }}"> {{ trans('message.equipmentManage') }}</a></li>
        <li class="active">{{ trans('message.equipment') }}{{ trans('message.add') }}</li>
      </ol>
    </section>

    <!-- Main content -->
    <section class="content">
      <div class="row">
        <div class="col-md-12">
          <!-- Horizontal Form -->
          <div class="box box-info">
            <div class="box-header with-border">
              <h3 class="box-title"> {{ trans('message.add') }}</h3>
              <div class="box-tools">
                <div class="btn-group pull-right" style="margin-right: 10px">
                  <a href="{{ url('equipment/list') }}" class="btn btn-sm btn-default"><i class="fa fa-list"></i>&nbsp; {{ trans('message.list') }}</a>
                </div>
                <div class="btn-group pull-right" style="margin-right: 10px">
                  <a class="btn btn-sm btn-default form-history-back" onclick="goBack()"><i class="fa fa-arrow-left"></i>&nbsp;{{ trans('message.history-back') }}</a>
                </div>
              </div>
            </div>
            <!-- /.box-header -->
            <!-- form start -->
            <form name="createForm" action="{{url('equipment/')}}"   class="form-horizontal" id="form-add" method="post">
              <input type="hidden" name="_token" value="{{ csrf_token() }}">

              <div class="box-body">
                <div class="form-group {!! !$errors->has('e_name') ?: 'has-error' !!}">
                  <label for="e_name" class="col-sm-2 control-label">设备名称</label>
                  <div class="col-sm-8">
                      <span class="form-control-require">*</span>
                    <input type="text" class="form-control" id="e_name" name="e_name" placeholder="设备名称" value="{{ old('e_name') }}" autofocus required >
                    @if($errors->has('e_name'))
                      @foreach($errors->get('e_name') as $message)
                        <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i>{{$message}}</label></br>
                      @endforeach
                    @endif
                  </div>
                </div>

                <div class="form-group {!! !$errors->has('e_code') ?: 'has-error' !!}">
                  <label for="e_code" class="col-sm-2 control-label">设备编号</label>
                  <div class="col-sm-8">
                      <span class="form-control-require">*</span>
                    <input type="text" class="form-control" id="e_code" name="e_code" placeholder="设备编号" value="{{ old('e_code') }}"  required >
                    @if($errors->has('e_code'))
                      @foreach($errors->get('e_code') as $message)
                        <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i>{{$message}}</label></br>
                      @endforeach
                    @endif
                  </div>
                </div>


                <div class="form-group {!! !$errors->has('bank_show_id') ?: 'has-error' !!}">
                  <label for="bank_show_id" class="col-sm-2 control-label">所属网点</label>
                  <div class="col-sm-8">
                    <span class="form-control-require">*</span>
                      <select class="form-control" name="bank_show_id" required>
                          @if($bankShop)
                              @foreach($bankShop as $shop)
                                  <option value="{{ $shop->id }}" >{{ $shop->shopName }}</option>
                              @endforeach
                          @endif
                      </select>
                    @if($errors->has('bank_show_id'))
                      @foreach($errors->get('bank_show_id') as $message)
                        <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i>{{$message}}</label></br>
                      @endforeach
                    @endif
                  </div>
                </div>

              <div class="form-group {!! !$errors->has('e_dec') ?: 'has-error' !!}">
                  <label for="e_dec" class="col-sm-2 control-label">设备描述</label>
                  <div class="col-sm-8">
                      <input type="text" class="form-control" id="e_dec" name="e_dec" placeholder="设备描述" value="{{ old('e_dec') }}"   >
                      @if($errors->has('e_dec'))
                          @foreach($errors->get('e_dec') as $message)
                              <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i>{{$message}}</label></br>
                          @endforeach
                      @endif
                  </div>
              </div>

                  <div class="form-group {!! !$errors->has('device_id') ?: 'has-error' !!}">
                      <label for="device_id" class="col-sm-2 control-label">控制板终端id</label>
                      <div class="col-sm-8">
                          <span class="form-control-require">*</span>
                          <input type="text" class="form-control" id="device_id" name="device_id" placeholder="终端id" value="{{ old('device_id') }}"  required >
                          @if($errors->has('device_id'))
                              @foreach($errors->get('device_id') as $message)
                                  <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i>{{$message}}</label></br>
                              @endforeach
                          @endif
                      </div>
                  </div>

                  <div class="form-group {!! !$errors->has('contact') ?: 'has-error' !!}">
                      <label for="contact" class="col-sm-2 control-label">联系人</label>
                      <div class="col-sm-8">
                          <input type="text" class="form-control" id="contact" name="contact" placeholder="联系人" value="{{ old('contact') }}"  >
                          @if($errors->has('contact'))
                              @foreach($errors->get('contact') as $message)
                                  <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i>{{$message}}</label></br>
                              @endforeach
                          @endif
                      </div>
                  </div>

                  <div class="form-group {!! !$errors->has('phone') ?: 'has-error' !!}">
                      <label for="phone" class="col-sm-2 control-label">联系电话</label>
                      <div class="col-sm-8">
                          <input type="text" class="form-control" id="phone" name="phone" placeholder="联系电话" value="{{ old('phone') }}" maxlength="11" >
                          @if($errors->has('phone'))
                              @foreach($errors->get('phone') as $message)
                                  <label class="control-label" for="inputError"><i class="fa fa-times-circle-o"></i>{{$message}}</label></br>
                              @endforeach
                          @endif
                      </div>
                  </div>

              </div>
              <!-- /.box-body -->
              <div class="box-footer">
                <div class="col-sm-2">
                </div>
                <div class="col-sm-8">
                  <div class="btn-group pull-right">
                    <button type="button" class="btn btn-info pull-right btn-js-form-submit" >提交</button>
                  </div>
                  <div class="btn-group pull-left">
                    <button type="reset" class="btn btn-warning">撤销</button>
                  </div>
                </div>
              </div>
              <!-- /.box-footer -->
            </form>
          </div>
          <!-- /.box -->
        </div>
        <!--/.col (right) -->
      </div>
      <!-- /.row -->
    </section>
    <!-- /.content -->
  </div>

  <!-- /.content-wrapper -->
@include('public.bottom')

  <!-- Control Sidebar -->
{{--@include('public.aside')--}}
  <!-- /.control-sidebar -->
  <!-- Add the sidebar's background. This div must be placed
       immediately after the control sidebar -->
  <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

@include('public.javascript')
{{--<script src="{{ asset ("/AdminLTE/bower_components/fastclick/lib/fastclick.js") }}" type="text/javascript"></script>--}}

<script type="text/javascript">
$(function(){
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': '{{ csrf_token() }}'
        }
    });

    @if(session()->has('fail'))
      alertMess("{{session()->get('fail')}}");
    @endif

});

var _ajaxSubmitSending = false;
$(".btn-js-form-submit").click(function (e) {
    if (_ajaxSubmitSending) {
        return;
    } else {
        _ajaxSubmitSending = true;
        _loadingFuc();
    }
    $('form[name="createForm"]').submit();
    _ajaxSubmitSending = false;
    setTimeout(function(){
        $.unblockUI();
    }, 1500);
});



</script>

</body>
</html>
